﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.ComponentModel;
namespace WPFExcelReport
{
    public partial class TSVS02
    {
       
        public TSVS02()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return; 
            MV = new VVESTAMM();
            this.DataContext = MV; 
            InitializeComponent();
         }
       
    
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            if (IsLoaded)
                return;
            LOADALL();
            base.Window_Loaded(sender, e);
           
        }
        public void LOADALL()
        {
            dwData = TBMain.NewRow();
            dwData["VEMANDANT"] = app.Mandant; 
            SResult = ((VVESTAMM)MV).QueryVESTAMM(dwData, -1);
            foreach (DataRow row in SResult.Tables[0].Rows)
            {
                row["DES"] = Helpers.Helper.GetGB2312Value(row["VEVERTNA"].ToString());
            }
            MergeData(SResult,false); 
        }
        public override void LOADBYAUF()
        {
            Locate("KEY", ORDERNUM);
         } 

        public override void ManageCommand(object sender, RoutedEventArgs e)
        {
            if (IsManage)
            {
                LOADALL();
            }
            else
            {
                VICC_WFEVENTS.SVWF.VS02(this.RUNID);
            }
            base.ManageCommand(sender, e);
        }
    }
}
